﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using AspNetCs.Common;
using AspNetCs.Model;
using AspNetCs.Bll;

public partial class PlayVideo : BasePage
{
    public int id = 0;
    public int addressIndex = 1;
    public VideoModel model=new VideoModel();

    public string displayAddress = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            id = StringHelper.isNumber_int(Request["id"]);
            addressIndex = StringHelper.isNumber_int(Request["addressIndex"]);
            if(id<=0)
            {
                Response.Write("页面不存在");
                Response.End();
                return;
            }

            string cmdText = "update video set hot=hot+1 where id={0}";
            cmdText = string.Format(cmdText,this.id);
            ExcuteSqlTextBLL.ExcuteResult(cmdText);
            GetModel();
            
        }
        else
        { 
        
        }
    }


    public void GetModel()
    {
        this.model=Video_BLL.CreateNew.GetModel("id="+id);
        switch (addressIndex)
        {
            case 1:
                displayAddress = model.Address1;
                break;
            case 2:
                displayAddress = model.Address2;
                break;
            case 3:
                displayAddress = model.Address3;
                break;
            case 4:
                displayAddress = model.Address4;
                break;
            case 5:
                displayAddress = model.Address5;
                break;
            case 6:
                Response.Write("页面不存在!");
                Response.End();
                break;
        }
    }
}
